package com.lc.zpyh.wxapi;

import android.util.Log;

import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
import com.umeng.socialize.weixin.view.WXCallbackActivity;

/**
 *    author : Android 
 *    github : https://github.com/getActivity/AndroidProject
 *    time   : 2019/05/06
 *    desc   : 微信登录回调（请注意这个 Activity 放置的包名要和当前项目的包名保持一致，否则将不能正常回调）
 */
public final class WXEntryActivity extends WXCallbackActivity implements IWXAPIEventHandler {
    @Override
    protected void onStart() {
        super.onStart();
        Log.e("WXPayEntryActivity", "onReq: 66666666666666666");
        finish();

    }

    @Override
    public void onReq(BaseReq baseReq) {
        Log.e("WXPayEntryActivity", "onReq: 111111111111111");
    }

    @Override
    public void onResp(BaseResp baseResp) {
        Log.e("WXPayEntryActivity", "onResp: 2222222222222");
        if (baseResp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
            WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) baseResp;
            String extraData =launchMiniProResp.extMsg; //对应小程序组件 <button open-type="launchApp"> 中的 app-parameter 属性
            Log.e("TAG", "onResp: "+extraData);
        }
        Log.e("TAG", "onResp: ----------------");
        finish();
    }
}